< previous page page_807 next page >

Page 807
Type.gifListing 21.14. Code for the Cancel button.
Private Sub cmdCancel_Click()
    '
    blnOK = False
    Me.Hide
    '
End Sub
That's it for the User Login form. Save this form as FRMUSERLOGIN.FRM.
Now you need to add more code to the PRJUSROBJECT class library file. You need three routines. The first routine to add is the UserLogin method. This method calls the login form and then calls other routines to verify the login and update the user's record in the secUsers table.
Create a new Public function called UserLogin and add the code from Listing 21.15.
Type.gifListing 21.15. Adding the LoginUser function to the DLL library.
Public Function UserLogin() As Boolean
    '
    ' handle user login attempts
    '
    On Error GoTo LocalErr
    '
    Static intTries As Integer
    Dim blnValidUser As Boolean
    Dim intAnswer As Integer
    '
UserLoginAttempt:
    '
    frmUserLogIn.strTitle = strTitle
    frmUserLogIn.Show vbModal
    '
    ' did user cancel login?
    If frmUserLogIn.blnOK = False Then
        UserLogin = False
        GoTo UserLoginExit
    End If
    '
    ' verify login
    If frmUserLogIn.blnOK = True Then
        intTries = intTries + 1
        blnValidUser = CheckUser(frmUserLogIn.txtUserID,
frmUserLogIn.txtPassword)
        If blnValidUser = True Then
            strUserIDProp = frmUserLogIn.txtUserID ' save to properties
            modUsrObject.strUserIDSaved = strUserIDProp
            LogUser urLogIn ' update table
continues

 
< previous page page_807 next page >

If you like this book, buy it!